using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Mpi.Common.Controls;

namespace Xid.Controls
{
    public partial class LabelTimePickerCtrl : UserControl
    {

        public string Label
        {
            get { return this.label.Text; }
            set { this.label.Text = value; }
        }

        [Bindable(true, BindingDirection.TwoWay)]
        public TimeSpan Value
        {
            get { return this.timeSpanBox1.Value; }
            set 
            { 
                this.timeSpanBox1.Value = value; 
            }
        }

        //public TimeSpanPicker.TimeSpanPicker TSP
        //{
        //    get
        //    {
        //        return this.timeSpanPicker1;
        //    }
        //}
        public LabelTimePickerCtrl()
        {
            InitializeComponent();
            
        }


        public event EventHandler ValueChanged;
        protected virtual void OnValueChanged()
        {
            if (this.ValueChanged != null)
                this.ValueChanged(this, new EventArgs()); 
        }


        private void timeSpanBox1_ValueChanged(object sender, EventArgs e)
        {
            toolTip.SetToolTip(this.timeSpanBox1, this.timeSpanBox1.ReadableValue);
            OnValueChanged();
        }
    }
}
